package com.daykw.xiaohongshu.task;

import java.util.Random;
import java.util.concurrent.ExecutorService;

import javax.annotation.PostConstruct;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.daykw.xiaohongshu.util.Const;
import com.daykw.xiaohongshu.util.ThreadPools;

public abstract class CustmTask implements Job {


	protected final static String IP_URL = "http://svip.kuaidaili.com/api/getproxy/?orderid=971514291852087&num=100&b_pcchrome=1&b_pcie=1&b_pcff=1&protocol=1&method=2&an_an=1&an_ha=1&sp1=1&quality=2&format=json&sep=1";

	protected Random random = new Random();

	public void execute(JobExecutionContext arg0) throws JobExecutionException {
		this.doWork();
	}

	@PostConstruct
	public void init() {
		System.out.println("############Cust Task start###############");
		this.doStart();
	}

	public abstract void doStart();

	public abstract void doWork();

	public ExecutorService getPool(int THREAD_SIZE) {
		return ThreadPools.getThreadPool(this, THREAD_SIZE + 1);
	}

}
